package TestAnimals;

// 定义父类Animal
class Animal {
    public void makeSound() {
        System.out.println("Animal sound");
    }
}

// 定义子类Dog
class Dog extends Animal {
    @Override
    public void makeSound() {
        System.out.println("Woof!");
    }
}

// 定义子类Cat
class Cat extends Animal {
    @Override
    public void makeSound() {
        System.out.println("Meow!");
    }
}

// 测试类
public class TestAnimals {
    public static void main(String[] args) {
        Dog dog = new Dog();
        Cat cat = new Cat();
        dog.makeSound();
        cat.makeSound();
    }
}
